package com.zhoux.server.demo;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerDemo {
	
	private int port =80;
	

	private  ServerSocket server =null;
	
	public  void RunServer(){
		System.out.println("start the server....");
		try {
			server=new ServerSocket(port);
			while(true){
				Socket socket = server.accept();
				new Processer(socket).run();
				
			}
		} catch (IOException e) {
			System.out.println("system is wrong!");
		}
	}
	
	public void RunServer(int port){
		this.port=port;
		RunServer();
	}
	
	public ServerDemo() {
		// TODO Auto-generated constructor stub
	}
	
	public static void main(String[] args) {
		ServerDemo server=new ServerDemo();
		server.RunServer(80);
	}
	
}
